<template>
	<view style="padding: 30rpx;">
		<view>异步接口</view>
		<button @click="callStorageFun(1)" type="warn">clearStorage</button>
		<button @click="callStorageFun(2)" type="warn">clearStorage</button>
		<button @click="callStorageFun(3)" type="warn">clearStorage</button>
		<button @click="callStorageFun(4)" type="warn">clearStorage</button>
		<button @click="callStorageFun(5)" type="warn">clearStorage</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: 'lelele',
				timer1: null
			}
		},
		methods: {
			callStorageFun(parm) {
				console.log("callStorageFun==>parm" + parm);
				switch (parm) {
					case 1:
						uni.setStorage({
							key: 'UserName',
							data: 'zb',
							success() {
								console.log("UserName 存储成功");
							}
						});
						console.log("调用存储完成");
						break;
					case 2:
					uni.getStorage({
						key:'Accout',
						success() {
							console.log("读取UserName成功");
						},
						fail() {
							console.log("读取UserName失败");
						}
					});
					break;
					case 3:
					uni.getStorageInfo({
						success:function(result) {
							console.log("获取所有字段:"+result.keys);
						}
					})
					break;
				}
			}
		}
	}
</script>

<style>

</style>